import React, { Component } from 'react';
import {withRouter} from 'react-router-dom';
import Swiper from 'swiper';
import 'swiper/css/swiper.css';
import BannnerStyled from "./bannerstyled";
class banner extends Component {
    constructor(props){
        super(props)
        this.state={
            index:1
        }
    }
    componentDidMount(){
        new Swiper('.swiper-container', { 
            autoplay:true,
            loop:true,
            on: {
                slideChange: () =>{
                //   console.log(this.activeIndex);
                    this.setState({
                        index:this.activeIndex
                    })
                }
            }
        });
    }
    // fun=()=>{
    //     this.props.history.push("/news");
    // }
   
    render() {
        return (
            <div>
                    <BannnerStyled>
                        <div className="swiper-container">
                            <div className="swiper-wrapper">
                                <div className="swiper-slide"><img src="banner/cptx_img_app0.jpg" alt=""/></div>
                                <div className="swiper-slide"><img src="banner/cptx_img_app1.png" alt=""/></div>
                                <div className="swiper-slide"><img src="banner/cptx_img_app2.png" alt=""/></div>
                                <div className="swiper-slide"><img src="banner/cptx_img_app3.png" alt=""/></div>
                                <div className="swiper-slide"><img src="banner/cptx_img_app4.png" alt=""/></div>
                            </div>
                        </div>
                    </BannnerStyled>
            </div>
        )
    }
}
export default withRouter(banner);